from datetime import datetime

import nonebot
import pytz
from aiocqhttp.exceptions import Error as CQHttpError


@nonebot.scheduler.scheduled_job('cron', hour = '07',minute ='00' ,second = '00')
async def _():
    bot = nonebot.get_bot()
    f=open('c:\\awesome-bot\\awesome\\plugins\\1055991127.txt',encoding='utf-8')
    kb =eval(f.read())
    now = datetime.now().strftime('%Y-%m-%d')  # 获取当前日期
    now = now.replace('-', '')
    if now not in kb.keys():
        message = "今天没有课，好好自习"
    else:
        ulist = kb[now]
        message = ''
        for m in ulist:
            message = message + '\n' + m
    try:
        await bot.send_private_msg(user_id=1055991127,message='早上好，今日课表\n'+message)
    except CQHttpError:
        pass
@nonebot.scheduler.scheduled_job('cron', hour = '08',minute ='12' ,second = '00')
async def _():
    bot = nonebot.get_bot()
    f=open('c:\\awesome-bot\\awesome\\plugins\\1055991127.txt',encoding='utf-8')
    kb =eval(f.read())
    now = datetime.now().strftime('%Y-%m-%d')  # 获取当前日期
    now = now.replace('-', '')
    if now not in kb.keys():
        message = "今天没有课，好好自习"
    else:
        ulist = kb[now]
        message = ''
        for m in ulist:
            message = message + '\n' + m
    try:
        await bot.send_private_msg(user_id=1055991127,message='早上好，今日课表\n'+message)
    except CQHttpError:
        pass
